package com.yyg.usecase.file;

import org.junit.Test;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class BufferedWriterTest {


    //调用flush会写入磁盘
    @Test
    public void BufferedFlushTest(){
        try {
            BufferedWriter bufferedWriter = new BufferedWriter(
                    new FileWriter("C:\\Users\\yuang\\Desktop\\tempOut.txt",Boolean.FALSE));
            bufferedWriter.write("Hello World2");
            bufferedWriter.flush();
            throw new RuntimeException("test");
        } catch (IOException e) {
            System.out.println("IOException");
        }
    }

}
